* merge daily data with customer info data (billcap identifiers) and location data (postcode, other info)
* generate variables to estimate treatment effects

******
***MERGING 

clear
set more off
use Data/daily

* merge with location data
merge m:1 account_number using Data/location


*** Drop customers with no meter data 
drop if _merge==2
drop _merge

* merge with customer data
merge m:1 account_number using Data/customer_info

rename _merge mergecustomer

drop if mergecustomer ==2

***********
* use address data to  missing postcodes 
merge m:1 account_number using Data/address
drop postcode
rename pcode postcode
drop if _merge==2

drop _merge 
*(still have obs without postcode info)
save Data/daily_merged, replace

